window.__GlobalCache__ = {};

import Vue from 'vue';

const state = {
    cacheObj: {
        key222: 'value'
    },
};
const getters = {};
const mutations = {};
const actions = {
    deleteCacheKey(context, obj) {
        delete window.__GlobalCache__[obj.key];
        Vue.delete(context.state.cacheObj, obj.key);
        // delete context.state.cacheObj[obj.key];
    },
    setFromCode(context, obj) {
        Vue.set(context.state.cacheObj, obj.key, obj.value);
    },
    setFromEdit(context, obj) {
        Vue.set(context.state.cacheObj, obj.key, obj.value);
        window.__GlobalCache__[obj.key] = obj.value;
    },
};

export default {
    namespaced: true,
    state,
    getters,
    mutations,
    actions
}